<?php
namespace HelloWord\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class AuthController extends AbstractActionController
{
	private $loginForm;
	
	public function loginAction()
	{
		If(!$this->loginForm)
			throw new \BadMethodCallException('Login Form not yet set!');
		
		if($this->getRequest()->isPost()){
			$this->$loginForm->setData($this->getRequest()->getPost());
			
			if ($this->loginForm->isValid()) {
				var_dump($this->loginForm->getData());exit;
				} else {
					return new ViewModel(
							array(
									'form' => $this->loginForm
							)
					);
				}
		} else {
			return new ViewModel(
					array(
							'form' => $this->loginForm
							)
					);
			}
			
		}
		
		
		
		public function setLoginForm($loginForm)
		{
			$this->$loginForm = $loginForm;
		}
		
		public function getLoginForm()
		{
			return $this->$loginForm;
		}
		
	}


